<template>
  <el-dialog title="打印选择" :append-to-body="true" :visible.sync="visible" :before-close="close"
    :close-on-click-modal="false" width="35%">

    <cpreport v-if="cpReportVisible" @close="close('cpReportVisible')" :childDataForm="childDataForm"></cpreport>

    <zjpreport v-if="zjpReportVisible" @close="close('zjpReportVisible')" :childDataForm="childDataForm"></zjpreport>

    <ylreport v-if="ylReportVisible" @close="close('ylReportVisible')" :childDataForm="childDataForm"></ylreport>

    <flreport v-if="flReportVisible" @close="close('flReportVisible')" :childDataForm="childDataForm"></flreport>

    <zcbcreport v-if="zcbcReportVisible" @close="close('zcbcReportVisible')" :childDataForm="childDataForm"></zcbcreport>

    <bcreport v-if="bcReportVisible" @close="close('bcReportVisible')" :childDataForm="childDataForm"></bcreport>

	<wkcheck v-if="wkCheckVisible" @close="close('wkCheckVisible')" :childDataForm="childDataForm"></wkcheck>

  <wkreport v-if="wkReportVisible" @close="close('wkReportVisible')" :childDataForm="childDataForm"></wkreport>

  <wljs v-if="wljsReportVisible" @close="close('wljsReportVisible')" :childDataForm="childDataForm"></wljs>

  <wlbs v-if="wlbsReportVisible" @close="close('wlbsReportVisible')" :childDataForm="childDataForm"></wlbs>

  <yfb v-if="yfbCheckVisible" @close="close('yfbCheckVisible')" :childDataForm="childDataForm"></yfb>

  <zc v-if="zcCheckVisible" @close="close('zcCheckVisible')" :childDataForm="childDataForm"></zc>

  <wlpass v-if="wlPassVisible" @close="close('wlPassVisible')" :childDataForm="childDataForm"></wlpass>

  <cppass v-if="cpPassVisible" @close="close('cpPassVisible')" :childDataForm="childDataForm"></cppass>

  <gjgjw  v-if="gjgjwReportVisible" @close="close('gjgjwReportVisible')" :childDataForm="childDataForm"></gjgjw>

  <hwk v-if="hwkVisible" @close="close('hwkVisible')" :childDataForm="childDataForm"></hwk>

  <gethistory v-if="getHistoryVisible" @close="close('getHistoryVisible')" :childDataForm="childDataForm"></gethistory>

  <yfbwlysd v-if="yfbwlysdVisible" @close="close('yfbwlysdVisible')" :childDataForm="childDataForm"></yfbwlysd>

  </el-dialog>
</template>

<script>

  import yfb from './check/yfb.vue'

  import zc from './check/zc.vue'

  // 打印类型：成品报告书
  import cpreport from './report/chengpin.vue'

  // 打印类型：中间品报告书
  import zjpreport from './report/zhongjianpin.vue'

  //打印类型：原料报告书
  import ylreport from './report/yuanliao.vue'

  //打印类型：自产包材报告书
  import zcbcreport from './report/zichanbaocai.vue'

  //打印类型：辅料报告书
  import flreport from './report/fuliao.vue'

  //打印类型：包材报告书
  import bcreport from './report/baocai.vue'

  //稳考请验单
  import wkcheck from './check/wk.vue'

  //稳考 报告
  import wkreport from './report/wendingxingkaocha.vue'

  //物料接收
  import wljs from './receive/wuliaojieshou.vue'

  //物料标识
  import wlbs from './receive/wuliaobiaoshika.vue'

  import wlpass from './pass/wlpass.vue'

  import cppass from './pass/cppass.vue'

  import gjgjw from './report/guanjiangongjiwu.vue'

  import hwk from './check/hwk.vue'

  import gethistory from './check/gethistory.vue'

  import yfbwlysd from "./check/yfbwlysd.vue"

  export default {
    data() {
      return {
        visible:false,
        cpReportVisible:false,
        zjpReportVisible:false,
        ylReportVisible:false,
        zcbcReportVisible:false,
        flReportVisible:false,
        bcReportVisible:false,
        wkReportVisible:false,
        wkCheckVisible:false,
        wljsReportVisible:false,
        yfbCheckVisible:false,
        zcCheckVisible:false,
        wlbsReportVisible:false,
        wlPassVisible:false,
        cpPassVisible:false,
        gjgjwReportVisible:false,
        hwkVisible:false,
        getHistoryVisible:false,
        yfbwlysdVisible:false,
      }
    },
    props: ["childDataForm"],
    components: {
      cpreport,
      zjpreport,
      ylreport,
      zcbcreport,
      flreport,
      bcreport,
      wkcheck,
      wkreport,
      wljs,
      wlbs,
      yfb,
      zc,
      wlpass,
      cppass,
      gjgjw,
      hwk,
      gethistory,
      yfbwlysd
    },
    mounted() {
          this.visible = true;
          let printType = this.childDataForm.printType;//报告书
          let checkTypeName = this.childDataForm.checkTypeName;
          this.showOne(printType,checkTypeName);
    },
    methods: {
      showOne(printType,checkTypeName){
        if(printType == "报告书"){
          if(checkTypeName == "成品"){
            this.cpReportVisible = true;
          }else if(checkTypeName == "中间品"){
            this.zjpReportVisible = true;
          }else if(checkTypeName == "原料"){
            this.ylReportVisible = true;
          }else if(checkTypeName == "辅料"){
            this.flReportVisible = true;
          }else if(checkTypeName == "包材"){
            this.bcReportVisible = true;
          }else if(checkTypeName == "自产包材"){
            this.zcbcReportVisible = true;
          }else if(checkTypeName == "稳定性考察"){
            this.wkReportVisible = true;
          }else if(checkTypeName == "关键供给物"){
            this.gjgjwReportVisible = true;
          }
        }else if(printType == "请验单"){
          if(checkTypeName=="稳定性考察"){
            this.wkCheckVisible = true;
          }else if(checkTypeName=="原料" ||checkTypeName=="辅料" ||checkTypeName=="包材" ||checkTypeName=="其他"){
            this.yfbCheckVisible = true;
          }else if(checkTypeName=="中间品" || checkTypeName=="成品"){
            this.zcCheckVisible = true;
          }
          }else if(printType == "货位卡"){
            this.hwkVisible = true;
          }else if(printType == "取样记录"){
            this.getHistoryVisible = true;
          }else if(printType == "物料接收记录"){
              this.wljsReportVisible = true
          }else if(printType == "物料验收单"){
              this.yfbwlysdVisible = true
          }else if(printType == "物料标识卡"){
              this.wlbsReportVisible = true;
          }else if(printType == "放行审核单"){
              //区分物料还是产品
              if(checkTypeName=="关键供给物" ||checkTypeName=="原料" ||checkTypeName=="辅料" ||checkTypeName=="包材" ){
                this.wlPassVisible = true;
              }else{
                this.cpPassVisible = true;
              }
          }
      },
      close(val) {
        if (val) {
          this[val] = false
        }
        this.visible = false
        this.$emit('close')
      },
      /**
       * 是否为空字符串，全空格也是空字符串
       * @param str
       * @returns {Boolean}
       */
      isBlank(obj) {
        if (obj == null || typeof obj == "undefined" ||
          obj == "") {
          return true;
        }
        return false;
      }
    }
  }
</script>

<style>
</style>
